package com.ruoyi.business.enums;

import com.ruoyi.common.exception.ServiceException;
import lombok.Getter;

/**
 * @author liutao
 * @version 1.0
 * @description: 用户任务调研状态
 * @date 2024/4/8 15:03
 */
public enum UserSurveyStatus {
    IN_PROGRESS(0, "进行中"),
    SUBMITTED(1, "已提交"),
    COMPLETED(2, "已完成"),
    ;

    @Getter
    private final Integer key;
    @Getter
    private final String desc;

    UserSurveyStatus(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static UserSurveyStatus getByKey(Integer key) {
        for (UserSurveyStatus e : values()) {
            if (e.getKey().equals(key)) {
                return e;
            }
        }
        throw new ServiceException("enum not exists.");
    }
}
